package com.xuetang9.fujian.net.reponse;

import com.xuetang9.fujian.net.client.Client;

import java.util.HashMap;
import java.util.concurrent.TimeUnit;

/**
 * @describe:
 * @author:fujian
 * @date:2021/6/13
 * @Version: V1.0
 * @Package: com.xuetang9.fujian.net.reponse
 */
public class ExitResponseHandler extends AbstractResponseHandler{
    @Override
    public void handleRequest(HashMap<String, Object> message, Client client) {
        boolean success = (boolean) message.get("success");
        if (success){
            client.setStatues(Client.CLOSE);
            try {
                TimeUnit.MILLISECONDS.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.exit(0);
        }
    }
}
